#include <bits/stdc++.h>

using namespace std;

class Solutionexp {
private:
    static constexpr int mod = 1000000007;

public:
    vector<int> numsGame(vector<int>& nums) {
        using LL = long long;

        int n = nums.size();
        if (n == 1) {
            return {0};
        }

        for (int i = 0; i < n; ++i) {
            nums[i] -= i;
            cout << nums[i] << " ";
        }cout <<endl;

        priority_queue<int,vector<int>,less<int> > q0 ;
        priority_queue<int,vector<int>,greater<int> > q1;
        q0.push(min(nums[0], nums[1]));
        q1.push(max(nums[0], nums[1]));
        LL sum0 = q0.top(), sum1 = q1.top();
        vector<int> ans = {0, static_cast<int>(sum1 - sum0)};

        for (int i = 2; i < n; ++i) {
            if (nums[i] <= q0.top()) {
                q0.push(nums[i]);
                sum0 += nums[i];
            }
            else {
                q1.push(nums[i]);
                sum1 += nums[i];
            }
            if (q0.size() == q1.size() + 2) {
                int u = q0.top();
                q0.pop();
                sum0 -= u;
                q1.push(u);
                sum1 += u;
            }
            else if (q0.size() + 1 == q1.size()) {
                int u = q1.top();
                q1.pop();
                sum1 -= u;
                q0.push(u);
                sum0 += u;
            }
            LL delta = (i & 1) ? sum1 - sum0 : sum1 - sum0 + q0.top();
            ans.push_back(delta % mod);
        }

        return ans;
    }
};


//vector模拟超时了
typedef long long LL;
class Solution1 {
    static const int MOD = 1e9+7;
public:
    vector<int> numsGame(vector<int>& nums) {
        int len=nums.size();

        if(len==1){
            return {0};
        }

        for(int i=0;i<len;i++){
            nums[i]=nums[i]-i;
        }
       
        vector<int> minHeap{max(nums[0],nums[1])};
        vector<int> maxHeap{min(nums[0],nums[1])};
        LL minSum=minHeap[0],maxSum=maxHeap[0];
        vector<int> ans{0,static_cast<int>(minSum-maxSum)};
        for(int i=2;i<len;i++){
            // 先把数字放到堆里，找中位数
            if(nums[i]<=maxHeap[0]){
                //比前半部分的最大值要小于等于
                maxHeap.push_back(nums[i]);
                make_heap(maxHeap.begin(),maxHeap.end(),less<int>());
                maxSum+=nums[i];
            }else{
                //比后半部分的最小值要大
                minHeap.push_back(nums[i]);
                make_heap(minHeap.begin(),minHeap.end(),greater<int>());
                minSum+=nums[i];
            }
            //保证最大堆的数量比最小堆的数量多一
            if(minHeap.size()+2==maxHeap.size()){
                //左半部分比右本部分多两个，即最大堆比最小堆多两个元素
                //从最大堆堆里删除
                int t=maxHeap[0];
                pop_heap(maxHeap.begin(),maxHeap.end(),less<int>());
                maxSum-=t;
                maxHeap.pop_back();
                //加入到最小堆
                minHeap.push_back(t);
                push_heap(minHeap.begin(),minHeap.end(),greater<int>());
                minSum+=t;
            }else if(minHeap.size()==1+maxHeap.size()){
                //右半部分比左本部分多一个，即最小堆比最大堆多一个元素
                int t=minHeap[0];
                pop_heap(minHeap.begin(),minHeap.end(),greater<int>());
                minSum-=t;
                minHeap.pop_back();
                maxHeap.push_back(t);
                push_heap(maxHeap.begin(),maxHeap.end(),less<int>());
                maxSum+=t;
            }   
            ans.push_back(i&1?(minSum-maxSum)%MOD:(minSum-maxSum+maxHeap[0]));
        }
        return ans;
    }
};

typedef long long LL;
class Solution {
    static const int MOD = 1e9+7;
public:
    vector<int> numsGame(vector<int>& nums) {
        int len=nums.size();

        if(len==1){
            return {0};
        }

        for(int i=0;i<len;i++){
            nums[i]=nums[i]-i;
        }
        priority_queue<int,vector<int>,less<int> > maxHeap;
        priority_queue<int,vector<int>,greater<int> > minHeap;
        maxHeap.push(min(nums[0],nums[1])); 
        minHeap.push(max(nums[0],nums[1]));
        // vector<int> minHeap{max(nums[0],nums[1])};
        // vector<int> maxHeap{min(nums[0],nums[1])};
        LL minSum=minHeap.top(),maxSum=maxHeap.top();
        vector<int> ans{0,static_cast<int>(minSum-maxSum)};
        for(int i=2;i<len;i++){
            // 先把数字放到堆里，找中位数
            if(nums[i]<=maxHeap.top()){
                //比前半部分的最大值要小于等于
                maxHeap.push(nums[i]);
                maxSum+=nums[i];
            }else{
                //比后半部分的最小值要大
                minHeap.push(nums[i]);
                minSum+=nums[i];
            }
            //保证最大堆的数量比最小堆的数量多一
            if(minHeap.size()+2==maxHeap.size()){
                //左半部分比右本部分多两个，即最大堆比最小堆多两个元素
                //从最大堆堆里删除
                int t=maxHeap.top();
                maxHeap.pop();
                maxSum-=t;
                //加入到最小堆
                minHeap.push(t);
                minSum+=t;
            }else if(minHeap.size()==1+maxHeap.size()){
                //右半部分比左本部分多一个，即最小堆比最大堆多一个元素
                int t=minHeap.top();
                minHeap.pop();
                minSum-=t;
                maxHeap.push(t);
                maxSum+=t;
            }   
            ans.push_back(i&1?(minSum-maxSum)%MOD:(minSum-maxSum+maxHeap.top())%MOD);
        }
        return ans;
    }
};

int main(){
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    vector<int> x;
    int xx=0;
    while(cin >>xx){
        char c;
        cin >> c;
        // cout << xx << " ";
        x.push_back(xx);
    }

    Solution s;

    vector<int> ans=s.numsGame(x);
    for(int i=0;i<static_cast<int>(ans.size());i++){
        cout << ans[i] << ",";
    }cout <<endl;
    // vector<int> test;
    // for(int i=0;i<10;i++){
    //     test.push_back(i);
    // }
    // cout << test.size() <<endl;
    // test.pop_back();
    // cout << test.size() <<endl;
    
   

    return 0;
}